package com.tsky.casing.action;

import com.tsky.common.ActionUtil;
import com.tsky.common.BeanUtil;

/**
 * @describe: Struts2前台操作基础Action(无需经过登录过滤)
 * @author: cainiao
 * @version 1.0 
 * @time: 2010-2-27 上午02:10:37
 */
public class FrontAction extends BaseAction {

	@Override
	public String execute() throws Exception {
		Object invokeResult = null;
		
		if (!BeanUtil.isEmpty(this.getCommand())){
			invokeResult = this.getClass().getDeclaredMethod(this.getCommand()).invoke(this);
		}
		
        return (invokeResult == null)? SUCCESS : invokeResult.toString();
    }
	
	/**
	 * 判断用户是否已经登录
	 * 
	 * @author: cainiao
	 * @time: 2010-3-10 上午06:13:50
	 * @function:
	 * @return
	 */
	public boolean isLogin() {
		Object loginUser = ActionUtil.getAttribute("FrontUserSession");
		return !(loginUser == null);
	}
}
